<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/12/26
  Time: 10:51
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--taglib指令--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <meta charset="utf-8">
  <title>头部页面</title>
</head>
<body>
<div>
  <img src="${pageContext.request.contextPath}/img/logo.png" width="100%" />
</div>
<div style="float: right">

    <%--使用 jstl的核心标签库 c:if 判断

        重定向过来,从httpSession域对象中取数据
    --%>
  <c:if test="${empty loginAdmin }">
      <%--
        完成js点击事件
      --%>
      <%--超链接失效--%>
        <a href="javascript:void(0)" onclick="adminLogin()">登录</a>
  </c:if>
  <c:if test="${not empty loginAdmin}">
        欢迎&ensp;&ensp;${loginAdmin.username}

        <a href="${pageContext.request.contextPath}/admin?methodName=adminLogout" target="_top">退出</a>

  </c:if>
</div>
</body>
<script>
        function adminLogin(){


            //top对象:在浏览器浏览器顶部直接打开新的地址,不会在当前frame中打开
            top.location.href="${pageContext.request.contextPath}/admin/admin_login.jsp";
        }

</script>
</html>
